///////////////////////////////////////////////////////////////////////////
//// the cursor to show where text is typed
sounds {
   sample { name: "key-tap1" LOSSY 64;
      source: "kbd-tap.wav";
   }
   sample { name: "key-tap2" LOSSY 64;
      source: "kbd-tap2.wav";
   }
   sample { name: "key-tap3" LOSSY 64;
      source: "kbd-tap3.wav";
   }
   sample { name: "key-tap4" LOSSY 64;
      source: "kbd-tap4.wav";
   }
   sample { name: "key-tap5" LOSSY 64;
      source: "kbd-tap5.wav";
   }
}
#define KEY_RESPONSE(_to) \
      part { name: "k0"; type: RECT; \
         scale: 1; \
         description { state: "default" 0.0; \
            color: 255 255 255 0; /* no cc */ \
            color_class: "GLOW"; \
            rel.to: _to; \
            rel1.relative: 0.0 0.0; \
            rel1.offset: 0 0; \
            rel2.relative: 1.0 0.0; \
            rel2.offset: -1 0; \
            align: 0.0 0.0; \
            min: 1 1; \
            offscale; \
         } \
         description { state: "on" 0.0; \
            inherit: "default" 0.0; \
            color: 255 255 255 255; /* no cc */ \
         } \
         description { state: "out" 0.0; \
            inherit: "default" 0.0; \
            color: 255 255 255 0; /* no cc */ \
            rel1.relative: -1.0 -0.5; \
            rel2.relative:  2.0 -0.5; \
         } \
      } \
      part { name: "k1"; type: RECT; \
         scale: 1; \
         description { state: "default" 0.0; \
            color: 255 255 255 0; /* no ccc */ \
            color_class: "GLOW"; \
            rel.to: _to; \
            rel1.relative: 0.0 1.0; \
            rel1.offset: 0 0; \
            rel2.relative: 1.0 1.0; \
            rel2.offset: -1 0; \
            align: 0.0 0.0; \
            min: 1 1; \
            offscale; \
         } \
         description { state: "on" 0.0; \
            inherit: "default" 0.0; \
            color: 255 255 255 255; /* no cc */ \
         } \
         description { state: "out" 0.0; \
            inherit: "default" 0.0; \
            color: 255 255 255 0; /* no cc */ \
            rel1.relative: -1.0 1.5; \
            rel2.relative:  2.0 1.5; \
         } \
      } \
      program { signal: "key,down"; source: "terminology"; \
         script { \
            new buf[32]; \
            snprintf(buf,  31, "key-down%i", (rand() % 5) + 1); \
            run_program(get_program_id(buf)); \
         } \
      } \
      program { name: "key-down1"; \
         action: PLAY_SAMPLE "key-tap1" 1.0 INPUT; \
      } \
      program { name: "key-down2"; \
         action: PLAY_SAMPLE "key-tap2" 1.0 INPUT; \
      } \
      program { name: "key-down3"; \
         action: PLAY_SAMPLE "key-tap3" 1.0 INPUT; \
      } \
      program { name: "key-down4"; \
         action: PLAY_SAMPLE "key-tap4" 1.0 INPUT; \
      } \
      program { name: "key-down5"; \
         action: PLAY_SAMPLE "key-tap5" 1.0 INPUT; \
      } \
      program { signal: "key,down"; source: "terminology"; \
         action: STATE_SET "default" 0.0; \
         target: "k0"; \
         target: "k1"; \
         after: "key2"; \
      } \
      program { name: "key2"; \
         action: STATE_SET "on" 0.0; \
         target: "k0"; \
         target: "k1"; \
         after: "key3"; \
      } \
      program { name: "key3"; \
         action: STATE_SET "out" 0.0; \
         transition: DECELERATE 0.2; \
         target: "k0"; \
         target: "k1"; \
      }

group { name: "terminology/cursor";
   images.image: "grad-v-1.png" COMP;
   images.image: "grad-v-2.png" COMP;
   parts {
      // key "things" that fly out above/below
      part { name: "base";  type: SPACER;
         description { state: "default" 0.0;
         }
      }
      KEY_RESPONSE("base")
      // base colored rect block always there
      part { name: "b0"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color: 255 255 255 128; // no cc
            color_class: "GLOW";
            rel1.relative: 0.0 0.0;
            rel1.offset: 0 0;
            rel2.relative: 1.0 0.0;
            rel2.offset: -1 0;
            align: 0.0 0.0;
            min: 1 1;
            offscale;
         }
      }
      part { name: "b1"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color: 255 255 255 128; // no cc
            color_class: "GLOW";
            rel1.relative: 0.0 1.0;
            rel1.offset: 0 -1;
            rel2.relative: 1.0 1.0;
            rel2.offset: -1 -1;
            align: 0.0 1.0;
            min: 1 1;
            offscale;
         }
      }
      part { name: "b2"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color: 255 255 255 128; // no cc
            color_class: "GLOW";
            rel1.relative: 0.0 0.0;
            rel1.offset: 0 1;
            rel2.relative: 0.0 1.0;
            rel2.offset: 0 -2;
            align: 0.0 0.0;
            min: 1 1;
            offscale;
         }
      }
      part { name: "b3"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color: 255 255 255 128; // no cc
            color_class: "GLOW";
            rel1.relative: 1.0 0.0;
            rel1.offset: -1 1;
            rel2.relative: 1.0 1.0;
            rel2.offset: -1 -2;
            align: 1.0 0.0;
            min: 1 1;
            offscale;
         }
      }
      // light layered top + bottom lines and 2 gradient lines on left + right
      part { name: "r0"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.relative: 0.0 0.0;
            rel1.offset: 0 0;
            rel2.relative: 1.0 0.0;
            rel2.offset: -1 0;
            align: 0.0 0.0;
            min: 1 1;
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color:  255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "r01";
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.relative: 0.0 0.0;
            rel1.offset: 0 0;
            rel2.relative: 0.0 1.0;
            rel2.offset: 0 -1;
            align: 0.0 0.0;
            min: 1 0;
            max: 1 0;
            image.normal: "grad-v-1.png";
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            max: 1 0;
            max: 1 99999;
            color:  255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "r02";
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.relative: 1.0 0.0;
            rel1.offset: -1 0;
            rel2.relative: 1.0 1.0;
            rel2.offset: -1 -1;
            align: 1.0 0.0;
            min: 1 0;
            max: 1 0;
            image.normal: "grad-v-1.png";
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            max: 1 99999;
            color:  255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "r1"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.relative: 0.0 1.0;
            rel1.offset: 0 -1;
            rel2.relative: 1.0 1.0;
            rel2.offset: -1 -1;
            align: 0.0 1.0;
            min: 1 1;
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color:  255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "r11";
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.relative: 0.0 0.0;
            rel1.offset: 0 0;
            rel2.relative: 0.0 1.0;
            rel2.offset: 0 -1;
            align: 0.0 1.0;
            min: 1 1;
            max: 1 0;
            image.normal: "grad-v-2.png";
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            max: 1 99999;
            color:  255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "r12";
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.relative: 1.0 0.0;
            rel1.offset: -1 0;
            rel2.relative: 1.0 1.0;
            rel2.offset: -1 -1;
            align: 1.0 1.0;
            min: 1 1;
            max: 1 0;
            image.normal: "grad-v-2.png";
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            max: 1 99999;
            color:  255 255 255 255; // no cc
            visible: 1;
         }
      }
      programs {
         program { signal: "focus,in,noblink"; source: "terminology";
            action: STATE_SET "focused" 0.0;
            target: "r0";
            target: "r01";
            target: "r02";
            target: "r1";
            target: "r11";
            target: "r12";
         }
         program { name: "focus_in";
            signal: "focus,in"; source: "terminology";
            action: STATE_SET "focused" 0.0;
            transition: LINEAR 0.05 USE_DURATION_FACTOR 1;
            target: "r0";
            target: "r1";
            after: "focus2";
         }
         program { name: "focus2";
            action: STATE_SET "focused" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r01";
            target: "r02";
            target: "r11";
            target: "r12";
            after: "focus3";
         }
         program { name: "focus3";
            in: 0.5 0.0;
            action: STATE_SET "default" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r01";
            target: "r02";
            target: "r11";
            target: "r12";
            after: "focus4";
         }
         program { name: "focus4";
            action: STATE_SET "default" 0.0;
            transition: LINEAR 0.05 USE_DURATION_FACTOR 1;
            target: "r0";
            target: "r1";
            after: "focus5";
         }
         program { name: "focus5";
            in: 0.5 0.0;
            action: STATE_SET "focused" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r0";
            target: "r1";
            after: "focus2";
         }
         program { signal: "focus,out"; source: "terminology";
            action: ACTION_STOP;
            target: "focus_in";
            target: "focus2";
            target: "focus3";
            target: "focus4";
            target: "focus5";
            after: "focus_out2";
         }
         program { name: "focus_out2";
            action: STATE_SET "default" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r0";
            target: "r01";
            target: "r02";
            target: "r1";
            target: "r11";
            target: "r12";
         }
      }
   }
}

///////////////////////////////////////////////////////////////////////////
//// the cursor as a bar to show where text is typed
group { name: "terminology/cursor_bar";
   images.image: "grad-v-1.png" COMP;
   images.image: "grad-v-2.png" COMP;
   parts {
      // key "things" that fly out above/below
      part { name: "base";  type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            min: 3 0;
            fixed: 1 1;
            rel.to: "b0";
         }
      }
      KEY_RESPONSE("base")

      // base colored rect block always there
      part { name: "b0"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color: 255 255 255 128; // no cc
            color_class: "GLOW";
            rel1.relative: 0.0 0.0;
            rel1.offset: 0 0;
            rel2.relative: 0.0 1.0;
            rel2.offset: 0 -1;
            align: 0.0 0.0;
            min: 1 0;
            offscale;
         }
      }
      // light layered top + bottom lines and 2 gradient lines on left + right
      part { name: "r0"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 255; // no cc
            color_class: "CURSOR";
            rel1.relative: 0.0 0.5;
            rel1.offset: 0 0;
            rel2.relative: 0.0 0.5;
            rel2.offset: 0 -1;
            align: 0.0 0.5;
            min: 1 0;
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.0 0.0;
            rel2.relative: 0.0 1.0;
         }
      }
      part { name: "r01";
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.relative: 0.0 0.5;
            rel1.offset: 0 0;
            rel2.to: "r0";
            rel2.relative: 0.0 0.5;
            rel2.offset: 0 -1;
            align: 0.0 1.0;
            min: 1 0;
            image.normal: "grad-v-2.png";
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color:  255 255 255 255; // no cc
            rel1.relative: 0.0 0.0;
            visible: 1;
         }
      }
      part { name: "r02";
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.to: "r0";
            rel1.relative: 0.0 1.0;
            rel1.offset: 0 0;
            rel2.relative: 0.0 0.5;
            rel2.offset: 0 -1;
            align: 0.0 0.0;
            min: 1 0;
            image.normal: "grad-v-1.png";
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color:  255 255 255 255; // no cc
            rel2.relative: 0.0 1.0;
            visible: 1;
         }
      }
      programs {
         program { signal: "focus,in,noblink"; source: "terminology";
            action: STATE_SET "focused" 0.0;
            target: "r0";
            target: "r01";
            target: "r02";
         }
         program { name: "focus_in";
            signal: "focus,in"; source: "terminology";
            action: STATE_SET "focused" 0.0;
            transition: LINEAR 0.05 USE_DURATION_FACTOR 1;
            target: "r01";
            target: "r02";
            after: "focus2";
         }
         program { name: "focus2";
            action: STATE_SET "focused" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r0";
            after: "focus3";
         }
         program { name: "focus3";
            in: 0.5 0.0;
            action: STATE_SET "default" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r0";
            after: "focus4";
         }
         program { name: "focus4";
            action: STATE_SET "default" 0.0;
            transition: LINEAR 0.05 USE_DURATION_FACTOR 1;
            target: "r01";
            target: "r02";
            after: "focus5";
         }
         program { name: "focus5";
            in: 0.5 0.0;
            action: STATE_SET "focused" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r01";
            target: "r02";
            after: "focus2";
         }
         program { signal: "focus,out"; source: "terminology";
            action: ACTION_STOP;
            target: "focus_in";
            target: "focus2";
            target: "focus3";
            target: "focus4";
            target: "focus5";
            after: "focus_out2";
         }
         program { name: "focus_out2";
            action: STATE_SET "default" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r0";
            target: "r01";
            target: "r02";
         }
      }
   }
}

///////////////////////////////////////////////////////////////////////////
//// the cursor as an underline to show where text is typed
group { name: "terminology/cursor_underline";
   images.image: "grad-h-1.png" COMP;
   images.image: "grad-h-2.png" COMP;
   parts {
      // key "things" that fly out above/below
      part { name: "base";  type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            min: 3 0;
            fixed: 1 1;
            rel.to: "b0";
         }
      }
      KEY_RESPONSE("base")

      // base colored rect block always there
      part { name: "b0"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color: 255 255 255 128; // no cc
            color_class: "GLOW";
            rel1.relative: 0.0 1.0;
            rel1.offset: 0 -1;
            rel2.relative: 1.0 1.0;
            rel2.offset: -1 -1;
            align: 0.0 0.0;
            min: 0 1;
            offscale;
         }
      }
      // light layered top + bottom lines and 2 gradient lines on left + right
      part { name: "r0"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 255; // no cc
            color_class: "CURSOR";
            rel1.relative: 0.5 1.0;
            rel1.offset: 0 -1;
            rel2.relative: 0.5 1.0;
            rel2.offset: -1 -1;
            align: 0.5 1.0;
            min: 0 1;
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.0 1.0;
            rel2.relative: 1.0 1.0;
         }
      }
      part { name: "r01";
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.relative: 0.5 1.0;
            rel1.offset: 0 -1;
            rel2.to: "r0";
            rel2.relative: 0.0 1.0;
            rel2.offset: 0 -1;
            align: 0.0 1.0;
            min: 0 1;
            image.normal: "grad-h-2.png";
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color:  255 255 255 255; // no cc
            rel1.relative: 0.0 1.0;
            visible: 1;
         }
      }
      part { name: "r02";
         scale: 1;
         description { state: "default" 0.0;
            color:  255 255 255 0; // no cc
            color_class: "CURSOR";
            visible: 0;
            rel1.to: "r0";
            rel1.relative: 1.0 1.0;
            rel1.offset: 0 -1;
            rel2.relative: 0.5 1.0;
            rel2.offset: -1 -1;
            align: 0.0 0.0;
            min: 1 0;
            fixed: 1 1;
            image.normal: "grad-h-1.png";
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color:  255 255 255 255; // no cc
            rel2.relative: 1.0 1.0;
            visible: 1;
         }
      }
      programs {
         program { signal: "focus,in,noblink"; source: "terminology";
            action: STATE_SET "focused" 0.0;
            target: "r0";
            target: "r01";
            target: "r02";
         }
         program { name: "focus_in";
            signal: "focus,in"; source: "terminology";
            action: STATE_SET "focused" 0.0;
            transition: LINEAR 0.05 USE_DURATION_FACTOR 1;
            target: "r01";
            target: "r02";
            after: "focus2";
         }
         program { name: "focus2";
            action: STATE_SET "focused" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r0";
            after: "focus3";
         }
         program { name: "focus3";
            in: 0.5 0.0;
            action: STATE_SET "default" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r0";
            after: "focus4";
         }
         program { name: "focus4";
            action: STATE_SET "default" 0.0;
            transition: LINEAR 0.05 USE_DURATION_FACTOR 1;
            target: "r01";
            target: "r02";
            after: "focus5";
         }
         program { name: "focus5";
            in: 0.5 0.0;
            action: STATE_SET "focused" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r01";
            target: "r02";
            after: "focus2";
         }
         program { signal: "focus,out"; source: "terminology";
            action: ACTION_STOP;
            target: "focus_in";
            target: "focus2";
            target: "focus3";
            target: "focus4";
            target: "focus5";
            after: "focus_out2";
         }
         program { name: "focus_out2";
            action: STATE_SET "default" 0.0;
            transition: LINEAR 0.1 USE_DURATION_FACTOR 1;
            target: "r0";
            target: "r01";
            target: "r02";
         }
      }
   }
}
